<?php

declare(strict_types=1);

namespace App\Entity;

use App\Models\Cleaner;

class CleanerEntity extends ABaseEntity
{
    public function __construct(Cleaner $model = null)
    {
        if ($model === null) {
            $model = new Cleaner();
        }
        $this->model = $model;
    }

    //GET MODEL DATA
    public function getModelData(): array
    {
        $modelData = $this->model->toArray();
        if (isset($modelData['password'])) {
            unset($modelData['password']);
        }

        return $modelData;
    }

    //GET EXTRA DATA
    public function getExtraData(): array
    {
        $extras = [];
        foreach ($this as $key => $var) {
            if ($key == 'model') {
                continue;
            }
            $extras[$key] = $var;
        }

        return $extras;
    }

    //id
    public function getId(): int
    {
        return $this->model->id;
    }

    public function setId(int $id): void
    {
        $this->model->id = $id;
    }

    //realname
    public function getRealName(): string
    {
        return $this->model->realname;
    }

    public function setRealName(string $realName): void
    {
        $this->model->realname = $realName;
    }

    //phone
    public function getPhone(): string
    {
        return $this->model->phone;
    }

    public function setPhone(string $phone): void
    {
        $this->model->phone = $phone;
    }

    //gender
    public function getGender(): int
    {
        return $this->model->gender;
    }

    public function setGender(int $gender): void
    {
        $this->model->gender = $gender;
    }

    //age
    public function getAge(): int
    {
        return $this->model->age;
    }

    public function setAge(int $age): void
    {
        $this->model->age = min(100, $age);
    }

    //idcard
    public function getIdcard(): string
    {
        return $this->model->idcard;
    }

    public function setIdcard(string $idcard): void
    {
        $this->model->idcard = $idcard;
    }

    //avatar
    public function getAvatar(): string
    {
        return $this->model->avatar;
    }

    public function setAvatar(string $avatar): void
    {
        $this->model->avatar = $avatar;
    }

    //city_id
    public function getCityId(): int
    {
        return $this->model->city_id;
    }

    public function setCityId(int $cityId): void
    {
        $this->model->city_id = $cityId;
    }

    //status
    public function getStatus(): int
    {
        return $this->model->status;
    }

    public function setStatus(int $status): void
    {
        $this->model->status = $status;
    }

    public function getStatusName(): string
    {
        return $this->statusName;
    }

    public function setStatusName(string $statusName): void
    {
        $this->statusName = $statusName;
    }

    //password
    public function getPassword(): string
    {
        return $this->model->password;
    }

    public function setPassword(string $password): void
    {
        $this->model->password = $password;
    }

    //last_login
    public function getLastLogin(): int
    {
        return $this->model->last_login;
    }

    public function setLastLogin(int $lastLogin): void
    {
        $this->model->last_login = $lastLogin;
    }

    //last_work
    public function getLastWork(): int
    {
        return $this->model->last_work;
    }

    public function setLastWork(int $lastWork): void
    {
        $this->model->last_work = $lastWork;
    }

    //company_id
    public function getCompanyId(): int
    {
        return $this->model->company_id;
    }

    public function setCompanyId(int $companyId): void
    {
        $this->model->company_id = $companyId;
    }

    //resign_time
    public function getResignTime(): int
    {
        return $this->model->resign_time;
    }

    public function setResignTime(int $resignTime): void
    {
        $this->model->resign_time = $resignTime;
    }

    //resign_reason
    public function getResignReason(): string
    {
        return $this->model->resign_reason;
    }

    public function setResignReason(string $resignReason): void
    {
        $this->model->resign_reason = $resignReason;
    }

    //create_time
    public function getCreateTime(): int
    {
        return $this->model->create_time;
    }

    public function setCreateTime(int $createTime): void
    {
        $this->model->create_time = $createTime;
    }

    //gender name
    public function getGenderName(): string
    {
        return $this->genderName;
    }

    public function setGenderName(string $genderName): void
    {
        $this->genderName = $genderName;
    }

    //city name
    public function getCityName(): string
    {
        return $this->cityName;
    }

    public function setCityName(string $cityName): void
    {
        $this->cityName = $cityName;
    }

    //skills
    public function getSkillData(): array
    {
        return $this->skills ?? [];
    }

    public function setSkillData(array $skillData): void
    {
        $this->skills = $skillData;
    }

    //skill_ids
    public function getSkillIds(): array
    {
        return $this->skillIds ?? [];
    }

    public function setSkillIds(array $skillIds): void
    {
        $this->skillIds = $skillIds;
    }

    //district ranges
    public function getDistrictRanges(): array
    {
        return $this->districtRanges;
    }

    public function setDistrictRanges(array $districtRanges): void
    {
        $this->districtRanges = $districtRanges;
    }

    public function getDistrictIds(): array
    {
        return $this->districtIds ?? [];
    }

    public function setDistrictIds(array $districtIds): void
    {
        $this->districtIds = $districtIds;
    }

    public function getLevel(): int
    {
        return $this->model->level;
    }

    public function setLevel(int $level): void
    {
        $this->model->level = $level;
    }

    public function getLevelName(): string
    {
        return $this->levelName;
    }

    public function setLevelName(string $levelName): void
    {
        $this->levelName = $levelName;
    }

    public function getWorkPosition(): array
    {
        return $this->workPosition;
    }

    public function setWorkPosition(array $workPosition): void
    {
        $this->workPosition = $workPosition;
    }

    public function getMaxDailyOrder(): int
    {
        return $this->model->max_daily_order;
    }

    public function setMaxDailyOrder(int $maxDailyOrder): void
    {
        $this->model->max_daily_order = $maxDailyOrder;
    }

    public function getRestStartTime(): int
    {
        return $this->model->rest_start_time;
    }

    public function setRestStartTime(int $restStartTime): void
    {
        $this->model->rest_start_time = $restStartTime;
    }

    public function getRestEndTime(): int
    {
        return $this->model->rest_end_time;
    }

    public function setRestEndTime(int $restEndTime): void
    {
        $this->model->rest_end_time = $restEndTime;
    }

    public function getRestId(): int
    {
        return $this->model->rest_id;
    }

    public function setRestId(int $restId): void
    {
        $this->model->rest_id = $restId;
    }

    public function getRestReason(): string
    {
        return $this->model->rest_reason;
    }

    public function setRestReason(string $restReason): void
    {
        $this->model->rest_reason = $restReason;
    }
}
